package newcrunch.gui.tree;

import javax.swing.tree.DefaultMutableTreeNode;
import org.antlr.runtime.tree.Tree;


/**
 * @author WL
 */
public class CustomTreeNode extends DefaultMutableTreeNode
{
    private TreeNodeType type;
    private String toolTip;
    private Tree tree; 
    
    /**
     * Generates a tree node that holds information in order to display it correctly
     * @param display - the text that will show in JTree
     * @param type - determines the icon that will be shown
     * @param tip - the tool tip that will be displayed
     * @param tree - the original node that this tree is generated from
     */
    public CustomTreeNode(String display, TreeNodeType type, String tip, Tree tree)
    {
        super(display);
        this.type = type;
        toolTip = tip;
        this.tree = tree;
    }
    
    public void setToolTip(String tip)
    {
        toolTip = tip;
    }
    
    public String getToolTip()
    {
        return toolTip;
    }
    
    public void setType(TreeNodeType treeType)
    {
        type = treeType;
    }
    
    public TreeNodeType getType()
    {
        return type;
    }
    
    public int getLineNumber()
    {
        return tree.getLine();
    }
}
enum TreeNodeType
{
    PRIVATE_METHOD, PUBLIC_METHOD, PROTECTED_METHOD, PACKAGE_METHOD,
    CLASS, INTERFACE, ENUM, ANNOTATION,
    ENUM_CONST, 
    PRIVATE_FIELD, PUBLIC_FIELD, PROTECTED_FIELD, PACKAGE_FIELD,
}